<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<#include "/common/resources.ftl"/>
<script type="text/javascript">
	$(function(){
		window.m_datagrid = $('#m_datagrid').datagrid({
			url:'${ctx}/channel/smshistory/smsSummary',
			onLoadSuccess:yixun.closeProgress,
			onBeforeLoad:yixun.progress,
			queryParams:$('#load_list_search').serializeObject(),
			loadMsg:null,
			singleSelect:true,
			fitColumns:true,
			rownumbers:true,
			pagination: false,
			border:'false',
			toolbar:'#m_toolbar'
		});
		//按条件查询用户
		window.searchData = function () {
			m_datagrid.datagrid('load',$('#load_list_search').serializeObject());
		}
	});
	mShowButton = function (value,row,index){
		var btns = [];
	    btns.push('<button class="green_btn" onclick="download('+row.merchantId+')">导出</button>');
		return btns.join('');
	}
	
	function download(merchantId){
		var createTimeBefore = $("input[name='createTimeBefore']").val();
		var createTimeAfter = $("input[name='createTimeAfter']").val();
		window.location.href="${ctx}/channel/export/smsSummaryExport?merchantId="+merchantId+"&createTimeBefore="+createTimeBefore+"&createTimeAfter="+createTimeAfter;
	}
</script>
</head>
<body style="background-color:white;">

<div id="m_toolbar" class="datagrid-toolbar" style="overflow: hidden;height: auto;margin: 15px 0px;background-color: white;border-bottom: none;" border="false">
  <form id="load_list_search" onsubmit="return false;">
  <div class="fm_sty" style="margin: 20px 0px 0px;">
   	<div class="ipt_line">
		<span class="ipt_title">发送时间</span>
		<input type="text" name="createTimeBefore" class="easyui-datebox" style="height:39px;width:125px;"/> - <input type="text" name="createTimeAfter" class="easyui-datebox" style="height:39px;width:125px;"/>
	</div>
	<div class="ipt_line_long">
        <button class="red_100" onclick="searchData()">查询</button>
	</div>    
  </div>
  </form>
</div>

<!-- 查找结果 -->
<table style="margin:0px 20px;" id="m_datagrid">
	<thead>
		<tr>
			<th field="companyName" width="60" height="40" >公司</th>
			<th field="sendCount" width="60" height="40" >发送数量</th>
			<th data-options="field:'id',formatter:mShowButton,align:'center'" width="150">操作</th>
		</tr>
	</thead>
</table>

</body>
</html>
